let defaultState:UserReduxType = {
    username:localStorage.getItem("username"),
    token:localStorage.getItem("token")
}
let userReducer = (state:UserReduxType=defaultState,actions:UserReduxActions)=>{
        switch(actions.type){
            case 'SET_USER_INFO':
                let newState = {...state};
                newState.username = actions.playload.username;
                newState.token = actions.playload?.token;
                return newState;
            default :
                return state;
        }
}

export default userReducer;